package com.xiaoba.product.controller;

import com.xiaoba.common.core.domain.Result;
import com.xiaoba.common.core.web.page.TableDataInfo;
import com.xiaoba.common.security.annotation.RequiresPermissions;
import com.xiaoba.product.domain.PmsAttrAttrgroupRelation;
import com.xiaoba.product.service.ItemService;
import com.xiaoba.product.vo.ItemInfo;
import com.xiaoba.product.vo.ItemSaleAttr;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.concurrent.ExecutionException;

import static com.xiaoba.common.core.utils.PageUtils.startPage;

/**
 * @Author: Gd
 * @package: com.xiaoba.product.controller
 * @Project: XiaoBa
 * @Name: ItemServiceController
 * @Date: 2024/6/5 9:55
 */
@RestController
@RequestMapping("/item")
public class ItemServiceController {

    @Autowired
    private ItemService itemService;

    @RequiresPermissions("search:itemIndex:list")
    @GetMapping("/{skuId}")
    public Result<ItemInfo> itemList(@PathVariable("skuId") Long skuId) throws ExecutionException, InterruptedException {
        ItemInfo itemBySkuId = itemService.getItemBySkuId(skuId);
        return Result.success(itemBySkuId);
    }
}
